import java.lang.reflect.ParameterizedType;

import uy.com.dino.samefile.model.project.Project;

public class Pepe<T extends Project> {

	T instance;

	public Pepe(T t) {
		instance = t;

	}

	@SuppressWarnings("unchecked")
	public T init() {
		T t = null;
		try {
			System.out.println(this.getClass());
			System.out.println(this.getClass().getTypeParameters().length);
			System.out.println(this.getClass().getTypeParameters()[0]);
			System.out.println(this.getClass().getTypeParameters()[0]
					.getClass());

			System.out.println((ParameterizedType) this.getClass()
					.getGenericSuperclass());

			System.out.println(getClass().getGenericSuperclass());

			System.out.println(((ParameterizedType) getClass()
					.getGenericSuperclass()).getActualTypeArguments());

			System.out.println(((ParameterizedType) getClass()
					.getGenericSuperclass()).getActualTypeArguments()[0]);

			Class<T> cdt = (Class<T>) ((ParameterizedType) getClass()
					.getGenericSuperclass()).getActualTypeArguments()[0];

			// this.clasePersistente = (Class<T>) ((ParameterizedType)
			// getClass()
			// .getGenericSuperclass()).getActualTypeArguments()[0];

			cdt.newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}

		return t;
	}

}
